<template>
	<view class="page-box">
		<uni-section title="请选择发布房源类型" type="line"></uni-section>
		<radio-group class="form-box" @change="radioChange">
			<view>
				<view>新房</view>
				<radio value="1" color="#f13b32" checked="true" />
			</view>
			<view>
				<view>二手房</view>
				<radio value="2" color="#f13b32" />
			</view>
			<view>
				<view>租房</view>
				<radio value="3" color="#f13b32" />
			</view>
		</radio-group>
		<view class="big-btn" @click="nextPage">下一步</view>
	</view>
</template>

<script>
	import uniSection from '@/components/uni-section/uni-section.vue'
	export default {
		components: {
			uniSection
		},
		data() {
			return {
				houses: {
					typeOfHouseSource: 1
				}
			}
		},
		methods: {
			radioChange(e) {
				this.houses.typeOfHouseSource = e.detail.value
			},
			nextPage() {
				console.log(parseInt(this.houses.typeOfHouseSource))
				let url = ''
				switch (parseInt(this.houses.typeOfHouseSource)) {
					case 1:
						url = '/pages/house/publishMsgNew?param=' + encodeURIComponent(JSON.stringify(this.houses))
						break;
					case 2:
						url = '/pages/house/publishMsg?param=' + encodeURIComponent(JSON.stringify(this.houses))
						break;
					case 3:
						url = '/pages/house/publishMsgRent?param=' + encodeURIComponent(JSON.stringify(this.houses))
						break;
				}
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page-box {
		padding-bottom: 88rpx;
		box-sizing: border-box;

		/deep/ .uni-section {
			margin-top: 0;
			background: #FFF;
		}

		/deep/ .line {
			background-color: #f13b32;
		}
	}

	.form-box {
		margin-bottom: 20rpx;
		padding-left: 40rpx;
		box-sizing: border-box;
		background: #FFF;

		>view {
			display: flex;
			padding-right: 20rpx;
			box-sizing: border-box;
			border-bottom: 1px solid #e5e5e5;
			box-sizing: border-box;
			justify-content: space-between;
			align-items: center;
			font-size: 24rpx;

			&:last-of-type {
				border-bottom: none;
			}

			view {
				width: 140rpx;
				line-height: 80rpx;
				font-size: 24rpx;
			}
		}
	}

	.big-btn {
		position: fixed;
		left: 0;
		bottom: 0;
		width: 100%;
		line-height: 88rpx;
		text-align: center;
		color: #FFF;
		background: #f13b32;
	}
</style>
